
$(document).ready(function() {
	
	$("#cp-submit").click(function(e) {
		var pwd1 = $("#cp-pwd1").val();
		var pwd2 = $("#cp-pwd2").val();
		var rpwd2 = $("#cp-r-pwd2").val();
		var pwdReg = /^[0-9A-Za-z!@#$%&*]{6,20}$/;
		if(!pwdReg.test(pwd1)) {
			Utils.msgDialog("原密码格式不正确！");
			return false;
		} else if(!pwdReg.test(pwd2)) {
			Utils.msgDialog("新密码格式不正确！");
			return false;
		} else if(!pwdReg.test(rpwd2)) {
			Utils.msgDialog("确认密码格式不正确！");
			return false;
		} else if(pwd2 != rpwd2) {
			Utils.msgDialog("两次输入密码不一致！");
			return false;
		}
		
        var param = {
			passWord: pwd1,
			newPassWord: pwd2,
		};
		AQ.callAQ("modifyPwd.do", param, function(result) {
			Utils.msgDialog("操作成功！");
			location.replace("user-center.html");
		}, function(err, code){
			Utils.msgDialog(err + "["+ code +"]");
		});
    });
	
});